package com.gzy.cbrsystem.insomnia;

import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.LockMode;
import org.springframework.context.ApplicationContext;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

/**
 * A data access object (DAO) providing persistence and search support for
 * TreatmentBit entities. Transaction control of the save(), update() and
 * delete() operations can directly support Spring container-managed
 * transactions or they can be augmented to handle user-managed Spring
 * transactions. Each of these methods provides additional information for how
 * to configure it for the desired type of transaction control.
 * 
 * @see com.gzy.cbrsystem.insomnia.TreatmentBit
 * @author MyEclipse Persistence Tools
 */

public class TreatmentBitDAO extends HibernateDaoSupport {
	private static final Log log = LogFactory.getLog(TreatmentBitDAO.class);
	// property constants
	public static final String GZMB1 = "gzmb1";
	public static final String GZMB2 = "gzmb2";
	public static final String GZMB3 = "gzmb3";
	public static final String GZMB4 = "gzmb4";
	public static final String GZMB5 = "gzmb5";
	public static final String GYMB6 = "gymb6";
	public static final String ZLZF1 = "zlzf1";
	public static final String ZLZF2 = "zlzf2";
	public static final String ZLZF3 = "zlzf3";
	public static final String ZLZF4 = "zlzf4";
	public static final String ZLZF5 = "zlzf5";
	public static final String ZLZF6 = "zlzf6";
	public static final String ZLZF7 = "zlzf7";
	public static final String ZLZF8 = "zlzf8";
	public static final String ZLZF9 = "zlzf9";
	public static final String ZLZF10 = "zlzf10";
	public static final String ZLZF11 = "zlzf11";
	public static final String ZLZF12 = "zlzf12";
	public static final String ZZZF13 = "zzzf13";
	public static final String ZZZF14 = "zzzf14";
	public static final String ZZZF15 = "zzzf15";
	public static final String ZYGYFA1 = "zygyfa1";
	public static final String ZYGYFA2 = "zygyfa2";
	public static final String ZYGYFA3 = "zygyfa3";
	public static final String ZYGYFA4 = "zygyfa4";
	public static final String ZYGYFA5 = "zygyfa5";
	public static final String ZYGYFA6 = "zygyfa6";
	public static final String ZYGYFA7 = "zygyfa7";
	public static final String YZM = "yzm";
	public static final String TJCF = "tjcf";
	public static final String ZJCF1 = "zjcf1";
	public static final String ZJCF2 = "zjcf2";
	public static final String ZJCF3 = "zjcf3";
	public static final String ZJCF4 = "zjcf4";
	public static final String ZJCF5 = "zjcf5";
	public static final String ZJCF6 = "zjcf6";
	public static final String ZJCF7 = "zjcf7";
	public static final String ZJCF8 = "zjcf8";
	public static final String ZJCF9 = "zjcf9";
	public static final String ZJCF10 = "zjcf10";
	public static final String XYCF1 = "xycf1";
	public static final String XYCF2 = "xycf2";
	public static final String XYCF3 = "xycf3";
	public static final String XYCF4 = "xycf4";
	public static final String XYCF5 = "xycf5";
	public static final String XYCF6 = "xycf6";
	public static final String XYCF7 = "xycf7";
	public static final String XYCF8 = "xycf8";
	public static final String YL1 = "yl1";
	public static final String YL2 = "yl2";
	public static final String YL3 = "yl3";
	public static final String YL4 = "yl4";
	public static final String YL5 = "yl5";
	public static final String YL6 = "yl6";
	public static final String ZLPL1 = "zlpl1";
	public static final String ZLPL2 = "zlpl2";
	public static final String ZLPL3 = "zlpl3";
	public static final String ZLPL4 = "zlpl4";
	public static final String XLZL = "xlzl";
	public static final String XWLF = "xwlf";

	protected void initDao() {
		// do nothing
	}

	public void save(TreatmentBit transientInstance) {
		log.debug("saving TreatmentBit instance");
		try {
			getHibernateTemplate().save(transientInstance);
			log.debug("save successful");
		} catch (RuntimeException re) {
			log.error("save failed", re);
			throw re;
		}
	}

	public void delete(TreatmentBit persistentInstance) {
		log.debug("deleting TreatmentBit instance");
		try {
			getHibernateTemplate().delete(persistentInstance);
			log.debug("delete successful");
		} catch (RuntimeException re) {
			log.error("delete failed", re);
			throw re;
		}
	}

	public TreatmentBit findById(java.lang.String id) {
		log.debug("getting TreatmentBit instance with id: " + id);
		try {
			TreatmentBit instance = (TreatmentBit) getHibernateTemplate().get(
					"com.gzy.cbrsystem.insomnia.TreatmentBit", id);
			return instance;
		} catch (RuntimeException re) {
			log.error("get failed", re);
			throw re;
		}
	}

	public List findByExample(TreatmentBit instance) {
		log.debug("finding TreatmentBit instance by example");
		try {
			List results = getHibernateTemplate().findByExample(instance);
			log.debug("find by example successful, result size: "
					+ results.size());
			return results;
		} catch (RuntimeException re) {
			log.error("find by example failed", re);
			throw re;
		}
	}

	public List findByProperty(String propertyName, Object value) {
		log.debug("finding TreatmentBit instance with property: "
				+ propertyName + ", value: " + value);
		try {
			String queryString = "from TreatmentBit as model where model."
					+ propertyName + "= ?";
			return getHibernateTemplate().find(queryString, value);
		} catch (RuntimeException re) {
			log.error("find by property name failed", re);
			throw re;
		}
	}

	public List findByGzmb1(Object gzmb1) {
		return findByProperty(GZMB1, gzmb1);
	}

	public List findByGzmb2(Object gzmb2) {
		return findByProperty(GZMB2, gzmb2);
	}

	public List findByGzmb3(Object gzmb3) {
		return findByProperty(GZMB3, gzmb3);
	}

	public List findByGzmb4(Object gzmb4) {
		return findByProperty(GZMB4, gzmb4);
	}

	public List findByGzmb5(Object gzmb5) {
		return findByProperty(GZMB5, gzmb5);
	}

	public List findByGymb6(Object gymb6) {
		return findByProperty(GYMB6, gymb6);
	}

	public List findByZlzf1(Object zlzf1) {
		return findByProperty(ZLZF1, zlzf1);
	}

	public List findByZlzf2(Object zlzf2) {
		return findByProperty(ZLZF2, zlzf2);
	}

	public List findByZlzf3(Object zlzf3) {
		return findByProperty(ZLZF3, zlzf3);
	}

	public List findByZlzf4(Object zlzf4) {
		return findByProperty(ZLZF4, zlzf4);
	}

	public List findByZlzf5(Object zlzf5) {
		return findByProperty(ZLZF5, zlzf5);
	}

	public List findByZlzf6(Object zlzf6) {
		return findByProperty(ZLZF6, zlzf6);
	}

	public List findByZlzf7(Object zlzf7) {
		return findByProperty(ZLZF7, zlzf7);
	}

	public List findByZlzf8(Object zlzf8) {
		return findByProperty(ZLZF8, zlzf8);
	}

	public List findByZlzf9(Object zlzf9) {
		return findByProperty(ZLZF9, zlzf9);
	}

	public List findByZlzf10(Object zlzf10) {
		return findByProperty(ZLZF10, zlzf10);
	}

	public List findByZlzf11(Object zlzf11) {
		return findByProperty(ZLZF11, zlzf11);
	}

	public List findByZlzf12(Object zlzf12) {
		return findByProperty(ZLZF12, zlzf12);
	}

	public List findByZzzf13(Object zzzf13) {
		return findByProperty(ZZZF13, zzzf13);
	}

	public List findByZzzf14(Object zzzf14) {
		return findByProperty(ZZZF14, zzzf14);
	}

	public List findByZzzf15(Object zzzf15) {
		return findByProperty(ZZZF15, zzzf15);
	}

	public List findByZygyfa1(Object zygyfa1) {
		return findByProperty(ZYGYFA1, zygyfa1);
	}

	public List findByZygyfa2(Object zygyfa2) {
		return findByProperty(ZYGYFA2, zygyfa2);
	}

	public List findByZygyfa3(Object zygyfa3) {
		return findByProperty(ZYGYFA3, zygyfa3);
	}

	public List findByZygyfa4(Object zygyfa4) {
		return findByProperty(ZYGYFA4, zygyfa4);
	}

	public List findByZygyfa5(Object zygyfa5) {
		return findByProperty(ZYGYFA5, zygyfa5);
	}

	public List findByZygyfa6(Object zygyfa6) {
		return findByProperty(ZYGYFA6, zygyfa6);
	}

	public List findByZygyfa7(Object zygyfa7) {
		return findByProperty(ZYGYFA7, zygyfa7);
	}

	public List findByYzm(Object yzm) {
		return findByProperty(YZM, yzm);
	}

	public List findByTjcf(Object tjcf) {
		return findByProperty(TJCF, tjcf);
	}

	public List findByZjcf1(Object zjcf1) {
		return findByProperty(ZJCF1, zjcf1);
	}

	public List findByZjcf2(Object zjcf2) {
		return findByProperty(ZJCF2, zjcf2);
	}

	public List findByZjcf3(Object zjcf3) {
		return findByProperty(ZJCF3, zjcf3);
	}

	public List findByZjcf4(Object zjcf4) {
		return findByProperty(ZJCF4, zjcf4);
	}

	public List findByZjcf5(Object zjcf5) {
		return findByProperty(ZJCF5, zjcf5);
	}

	public List findByZjcf6(Object zjcf6) {
		return findByProperty(ZJCF6, zjcf6);
	}

	public List findByZjcf7(Object zjcf7) {
		return findByProperty(ZJCF7, zjcf7);
	}

	public List findByZjcf8(Object zjcf8) {
		return findByProperty(ZJCF8, zjcf8);
	}

	public List findByZjcf9(Object zjcf9) {
		return findByProperty(ZJCF9, zjcf9);
	}

	public List findByZjcf10(Object zjcf10) {
		return findByProperty(ZJCF10, zjcf10);
	}

	public List findByXycf1(Object xycf1) {
		return findByProperty(XYCF1, xycf1);
	}

	public List findByXycf2(Object xycf2) {
		return findByProperty(XYCF2, xycf2);
	}

	public List findByXycf3(Object xycf3) {
		return findByProperty(XYCF3, xycf3);
	}

	public List findByXycf4(Object xycf4) {
		return findByProperty(XYCF4, xycf4);
	}

	public List findByXycf5(Object xycf5) {
		return findByProperty(XYCF5, xycf5);
	}

	public List findByXycf6(Object xycf6) {
		return findByProperty(XYCF6, xycf6);
	}

	public List findByXycf7(Object xycf7) {
		return findByProperty(XYCF7, xycf7);
	}

	public List findByXycf8(Object xycf8) {
		return findByProperty(XYCF8, xycf8);
	}

	public List findByYl1(Object yl1) {
		return findByProperty(YL1, yl1);
	}

	public List findByYl2(Object yl2) {
		return findByProperty(YL2, yl2);
	}

	public List findByYl3(Object yl3) {
		return findByProperty(YL3, yl3);
	}

	public List findByYl4(Object yl4) {
		return findByProperty(YL4, yl4);
	}

	public List findByYl5(Object yl5) {
		return findByProperty(YL5, yl5);
	}

	public List findByYl6(Object yl6) {
		return findByProperty(YL6, yl6);
	}

	public List findByZlpl1(Object zlpl1) {
		return findByProperty(ZLPL1, zlpl1);
	}

	public List findByZlpl2(Object zlpl2) {
		return findByProperty(ZLPL2, zlpl2);
	}

	public List findByZlpl3(Object zlpl3) {
		return findByProperty(ZLPL3, zlpl3);
	}

	public List findByZlpl4(Object zlpl4) {
		return findByProperty(ZLPL4, zlpl4);
	}

	public List findByXlzl(Object xlzl) {
		return findByProperty(XLZL, xlzl);
	}

	public List findByXwlf(Object xwlf) {
		return findByProperty(XWLF, xwlf);
	}

	public List findAll() {
		log.debug("finding all TreatmentBit instances");
		try {
			String queryString = "from TreatmentBit";
			return getHibernateTemplate().find(queryString);
		} catch (RuntimeException re) {
			log.error("find all failed", re);
			throw re;
		}
	}

	public TreatmentBit merge(TreatmentBit detachedInstance) {
		log.debug("merging TreatmentBit instance");
		try {
			TreatmentBit result = (TreatmentBit) getHibernateTemplate().merge(
					detachedInstance);
			log.debug("merge successful");
			return result;
		} catch (RuntimeException re) {
			log.error("merge failed", re);
			throw re;
		}
	}

	public void attachDirty(TreatmentBit instance) {
		log.debug("attaching dirty TreatmentBit instance");
		try {
			getHibernateTemplate().saveOrUpdate(instance);
			log.debug("attach successful");
		} catch (RuntimeException re) {
			log.error("attach failed", re);
			throw re;
		}
	}

	public void attachClean(TreatmentBit instance) {
		log.debug("attaching clean TreatmentBit instance");
		try {
			getHibernateTemplate().lock(instance, LockMode.NONE);
			log.debug("attach successful");
		} catch (RuntimeException re) {
			log.error("attach failed", re);
			throw re;
		}
	}

	public static TreatmentBitDAO getFromApplicationContext(
			ApplicationContext ctx) {
		return (TreatmentBitDAO) ctx.getBean("TreatmentBitDAO");
	}
}